package com.wonderful.wedding.repository;

import com.google.common.base.Optional;
import com.wonderful.wedding.mapper.GroupMapper;
import com.wonderful.wedding.model.Group;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;


@Repository
public class GroupRepository {

    @Autowired
    private GroupMapper mapper;

    public Optional<Group> findGroupByName(String name) {
        return Optional.fromNullable(mapper.findByName(name));
    }

    public int create(String groupName) {
        return mapper.create(groupName);

    }
}
